<html>
<head><meta charset="utf-8"><title>const param defaults · t-lang · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/index.html">t-lang</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html">const param defaults</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="246280463"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246280463" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246280463">(Jul 16 2021 at 21:11)</a>:</h4>
<p>the <code>const_generics_defaults</code> feature is basically working impl wise- it lets you write <code>struct Foo&lt;const N: usize = 2, const M: usize = N&gt;</code> or <code>struct Foo&lt;const N: usize = { usize::MAX - 1 }&gt;</code> or <code>struct Foo&lt;T = u32, const N: usize = 12&gt;</code> etc. It would be nice to stabilize this but it seems like there hasn't been any lang team input on it yet (no accepted RFC) Is writing up an RFC and getting it accepted the right way to proceed here?</p>



<a name="246282474"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246282474" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bstrie <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246282474">(Jul 16 2021 at 21:27)</a>:</h4>
<p>does this resolve the syntactic concerns WRT ordering type parameters and const parameters? or does this feature just pass on the issue of allowing type parameter defaults to coexist with const parameters</p>



<a name="246283319"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246283319" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246283319">(Jul 16 2021 at 21:36)</a>:</h4>
<p>the current implementation removes the orderign restriction on consts and types allowign them to be intermixed so it's <br>
&lt;lifetimes, consts and types, const and type defaults&gt;</p>



<a name="246517679"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246517679" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246517679">(Jul 19 2021 at 21:26)</a>:</h4>
<p>(still not sure how to proceed here :) )</p>



<a name="246517790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246517790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bstrie <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246517790">(Jul 19 2021 at 21:27)</a>:</h4>
<p>how big would the RFC be? would it just be discussing the syntactic ordering restrictions? otherwise the design seems pretty straightforwardly self-evident</p>



<a name="246518711"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246518711" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246518711">(Jul 19 2021 at 21:36)</a>:</h4>
<p>i think it would have to cover the ordering restrictions + future compat implications of not allowing generic constants for defaults</p>



<a name="246518765"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246518765" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246518765">(Jul 19 2021 at 21:37)</a>:</h4>
<p>I guess it would be a pretty short RFC</p>



<a name="246519727"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246519727" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bstrie <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246519727">(Jul 19 2021 at 21:47)</a>:</h4>
<p>but also, are there any alternatives, other than "just don't support this"? I don't recall what the original objection to allowing intermixed const and type parameters was in whatever RFC first outlined them, but I can't think of any reason not to allow them to intermix other than that we don't allow lifetime parameters to intermix, but that's not an especially strong reason</p>



<a name="246520144"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246520144" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246520144">(Jul 19 2021 at 21:52)</a>:</h4>
<p>im not sure why the restriction was there originally either</p>



<a name="246520160"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246520160" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246520160">(Jul 19 2021 at 21:52)</a>:</h4>
<p>i suppose an alternative would be <code>&lt;Lifetimes, Types, Consts, TypeDefaults, ConstDefaults&gt;</code></p>



<a name="246520171"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246520171" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246520171">(Jul 19 2021 at 21:52)</a>:</h4>
<p>but then you couldnt have a type default which includes a defaulted const param</p>



<a name="246520571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246520571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bstrie <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246520571">(Jul 19 2021 at 21:58)</a>:</h4>
<p>yeah looking at the original RFC comments I don't see any objections raised, especially not once the interaction with default arguments was broached. I'm not on the lang team but maybe just... open a stabilization PR and see what they think? <span aria-label="eyes" class="emoji emoji-1f440" role="img" title="eyes">:eyes:</span></p>



<a name="246520781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246520781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246520781">(Jul 19 2021 at 22:00)</a>:</h4>
<p>xd</p>



<a name="246520821"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246520821" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246520821">(Jul 19 2021 at 22:00)</a>:</h4>
<p>just yolo a stabilisation PR no problem okay xD</p>



<a name="246520847"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246520847" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246520847">(Jul 19 2021 at 22:01)</a>:</h4>
<p>I guess that is a pretty good way of figuring out whether they want to stabilise it lol <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="246524009"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246524009" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246524009">(Jul 19 2021 at 22:37)</a>:</h4>
<p>I think this at least warrants a stabilization report that covers everything that was said here and in the original RFC thread</p>



<a name="246524016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246524016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246524016">(Jul 19 2021 at 22:37)</a>:</h4>
<p>but a full-blown RFC might not be needed</p>



<a name="246525670"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246525670" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246525670">(Jul 19 2021 at 22:58)</a>:</h4>
<p>I'm not sure what you're referring to with "original RFC thread"</p>



<a name="246526662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246526662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bstrie <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246526662">(Jul 19 2021 at 23:10)</a>:</h4>
<p><a href="https://github.com/rust-lang/rfcs/pull/2000">https://github.com/rust-lang/rfcs/pull/2000</a></p>



<a name="246631692"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246631692" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246631692">(Jul 20 2021 at 18:38)</a>:</h4>
<p>One thing that comes to mind here is that type parameter defaults often don't do what people think they would -- see all the problems with the state parameter on <code>HashMap</code>.</p>
<p>Are all those confusions going to happen with const parameter defaults too?</p>



<a name="246648663"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246648663" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246648663">(Jul 20 2021 at 20:58)</a>:</h4>
<p><span class="user-mention silent" data-user-id="125270">scottmcm</span> <a href="#narrow/stream/213817-t-lang/topic/const.20param.20defaults/near/246631692">said</a>:</p>
<blockquote>
<p>One thing that comes to mind here is that type parameter defaults often don't do what people think they would -- see all the problems with the state parameter on <code>HashMap</code>.</p>
<p>Are all those confusions going to happen with const parameter defaults too?</p>
</blockquote>
<p>what are the problems with the state parameter you're thinking of?</p>



<a name="246656949"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246656949" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bstrie <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246656949">(Jul 20 2021 at 22:03)</a>:</h4>
<p>possibly it's referring to how type inference currently doesn't consider default parameters at all. Consider the following two lines, where the first is an error and the second isn't:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="kd">let</span><span class="w"> </span><span class="n">foo</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">HashMap</span>::<span class="n">from_iter</span><span class="p">([(</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="mi">2</span><span class="p">)]);</span><span class="w"> </span><span class="c1">// fail</span>
<span class="kd">let</span><span class="w"> </span><span class="n">foo</span>: <span class="nc">HashMap</span><span class="o">&lt;</span><span class="n">_</span><span class="p">,</span><span class="w"> </span><span class="n">_</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">HashMap</span>::<span class="n">from_iter</span><span class="p">([(</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="mi">2</span><span class="p">)]);</span><span class="w"> </span><span class="c1">// ok</span>
</code></pre></div>
<p>The error message is "cannot infer type for type parameter <code>S</code> declared on the struct <code>HashMap</code>". Since it knows that it has a hashmap, you'd think it would be capable of simply substituting the default parameter for <code>S</code>, but it doesn't. I'm not sure why default parameters are this way, but it would be nice to see it fixed eventually.</p>



<a name="246658402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246658402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246658402">(Jul 20 2021 at 22:22)</a>:</h4>
<p>ah yeah i think that's probably disallowed for the same reason <code>fn foo&lt;T = u32&gt;</code> is disallowed</p>



<a name="246658854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246658854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bstrie <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246658854">(Jul 20 2021 at 22:29)</a>:</h4>
<p>is there an RFC or tracking issue for making this possible? (default types in functions)</p>



<a name="246659076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246659076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246659076">(Jul 20 2021 at 22:32)</a>:</h4>
<p>forgot to hit enter...:</p>
<p>cg defaults do have the same inference error for <a href="https://play.rust-lang.org/?version=nightly&amp;mode=debug&amp;edition=2018&amp;gist=df7d9421f50b6a48bcfc699024dbb3f6">this kind of code</a></p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">struct</span> <span class="nc">Foo</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">N</span>: <span class="kt">usize</span> <span class="o">=</span><span class="w"> </span><span class="mi">20</span><span class="o">&gt;</span><span class="p">(</span><span class="n">T</span><span class="p">);</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="n">N</span>: <span class="kt">usize</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Foo</span><span class="o">&lt;</span><span class="n">T</span><span class="p">,</span><span class="w"> </span><span class="n">N</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">foo</span><span class="p">(</span><span class="n">arg</span>: <span class="nc">T</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Self</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="bp">Self</span><span class="p">(</span><span class="n">arg</span><span class="p">)</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="c1">//use std::iter::FromIterator;</span>
<span class="w">    </span><span class="c1">//let foo = std::collections::HashMap::from_iter([(1, 2)]);</span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">foo</span>: <span class="nc">Foo</span><span class="o">&lt;</span><span class="n">_</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Foo</span>::<span class="n">foo</span><span class="p">(</span><span class="mi">10</span><span class="p">);</span><span class="w"> </span><span class="c1">// fine</span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">foo</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Foo</span>::<span class="n">foo</span><span class="p">(</span><span class="mi">10</span><span class="p">);</span><span class="w"> </span><span class="c1">// type annotations needed</span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="246659103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246659103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246659103">(Jul 20 2021 at 22:32)</a>:</h4>
<p><span class="user-mention silent" data-user-id="256342">bstrie</span> <a href="#narrow/stream/213817-t-lang/topic/const.20param.20defaults/near/246658854">said</a>:</p>
<blockquote>
<p>is there an RFC or tracking issue for making this possible? (default types in functions)</p>
</blockquote>
<p><a href="https://github.com/rust-lang/rust/issues/36887">#36887</a></p>



<a name="246659116"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246659116" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246659116">(Jul 20 2021 at 22:32)</a>:</h4>
<p>more of a tracking issue for the future incompat lint</p>



<a name="246659163"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246659163" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246659163">(Jul 20 2021 at 22:33)</a>:</h4>
<p><span class="user-mention silent" data-user-id="326176">Boxy [she/her]</span> <a href="#narrow/stream/213817-t-lang/topic/const.20param.20defaults/near/246648663">said</a>:</p>
<blockquote>
<p>what are the problems with the state parameter you're thinking of?</p>
</blockquote>
<p>The ones <span class="user-mention" data-user-id="256342">@bstrie</span> mentioned.  <code>HashSet::from_iter(&amp;vec)</code> doesn't work but <code>HashSet::&lt;_&gt;::from_iter(&amp;vec)</code> does, to use an example I saw asked earlier today on a different forum.</p>
<p>I could easily imagine that something like <code>SmallVec&lt;T, const N: usize = 10&gt;</code> would hit <em>exactly</em> that problem.</p>



<a name="246659179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246659179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246659179">(Jul 20 2021 at 22:33)</a>:</h4>
<p>Yeah it probably would</p>



<a name="246659266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246659266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Boxy [she/her] <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246659266">(Jul 20 2021 at 22:34)</a>:</h4>
<p>I think it would be a bit weird for cg defaults to work differnt here than type defaults though so i'm not sure if this is something easily fixable</p>



<a name="246659802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/const%20param%20defaults/near/246659802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/const.20param.20defaults.html#246659802">(Jul 20 2021 at 22:42)</a>:</h4>
<p>I definitely think we should have these work as similarly as possible, yeah.</p>
<p>Especially given the conversation in some other thread about potentially treating <code>const N: usize</code> like <code>T: WithConst&lt;usize&gt;</code> internally to let every "be" a type.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>